<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>功能管理</title>
	
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#function_showname").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
	</script>
</head>

<body>
<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">管理功能</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
	<form id="inputForm" action="${ctx}/function/${action}" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${function.id}"/>
		<fieldset>
			<div class="form-group">
				<label for="function_showname" class="col-sm-3 control-label">显示名称:</label>
				<div class="col-sm-6">
					<input type="text" id="function_showname" name="showname"  value="${function.showname}" class="form-control input-large required" minlength="2"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="function_restype" class="col-sm-3 control-label">资源类型:</label>
				<div class="col-sm-6">
					<select id="function_restype" name="restype" class="form-control">
						<option value="0" <c:if test="${function.restype eq '0'}">selected="selected"</c:if>>一级菜单</option>
						<option value="1" <c:if test="${function.restype eq '1'}">selected="selected"</c:if>>二级菜单</option>
						<option value="2" <c:if test="${function.restype eq '2'}">selected="selected"</c:if>>三级菜单</option>
					</select>
				</div>
			</div>	
			<div class="form-group">
				<label for="function_urlprefix" class="col-sm-3 control-label">URL前缀:</label>
				<div class="col-sm-6">
					<input type="text" id="function_urlprefix" name="urlprefix"  value="${function.urlprefix}" class="form-control input-large required" minlength="1"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="function_viewurl" class="col-sm-3 control-label">视图URL:</label>
				<div class="col-sm-6">
					<input type="text" id="function_viewurl" name="viewurl"  value="${function.viewurl}" class="form-control input-large required" minlength="1"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="function_parentId" class="col-sm-3 control-label">父功能:</label>
				<div class="col-sm-6">
					<select id="function_parentId" name="function_id" class="form-control">
						<option value="-1"></option>
						<c:forEach items="${menu1}" var="menu">
							<option value="${menu.id}" <c:if test="${not empty function.function and function.function.id eq menu.id}">selected="selected"</c:if>>${menu.showname}</option>
						</c:forEach>
					</select>
				</div>
			</div>	
			<div class="form-group">
				<label for="function_status" class="col-sm-3 control-label">状态:</label>
				<div class="col-sm-6">
					<select id="function_status" name="status" class="form-control">
						<option value="1" <c:if test="${function.status eq '1'}">selected="selected"</c:if>>有效</option>
						<option value="0" <c:if test="${function.status eq '0'}">selected="selected"</c:if>>无效</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="function_idx" class="col-sm-3 control-label">排序:</label>
				<div class="col-sm-6">
					<input type="text" id="function_idx" name="idx"  value="${function.idx}" class="form-control input-large required" minlength="1"/>
				</div>
			</div>	
			<!--<div class="form-group">
				<label for="description" class="col-sm-3 control-label">任务描述:</label>
				<div class="col-sm-6">
					<textarea id="description" name="description" class="form-control input-large">${task.description}</textarea>
				</div>
			</div>	
			--><div class="modal-footer bg-gray">
				<input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/>&nbsp;	
				<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()"/>
			</div>
		</fieldset>
	</form>
	</div>
	</div>
	</div>
	</div>
	</section>
</body>
</html>
